package net.qiyuesuo.utils.file;

import java.io.IOException;
import java.util.Properties;

/**
 * 获取 properties中 数据
 */
public class PropertiesUtils {
	
	/**
	 * 获取 DataBase.properties 配置文件中数据
	 * @param key
	 * @return 
	 */
	public static String getDataBaseProperty(String key) {
		Properties prop = new Properties();
		try {
			prop.load(new Properties().getClass().getResourceAsStream("/db.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		String property = prop.getProperty(key);
		if(property == null) {
			try {
				throw new Exception("无法获取key: "+key+" 的值");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return property;
		
	}
	
}
